package com.jqq.homework;

import java.util.Scanner;

/**
 * @author 姬倩倩
 * @version 1.0
 */
public class Homework01 {
}
class EcmDef{
    public static void main(String[] args) {

        try {
            //先验证输入的参数个数是否正确 两个参数
            if(args.length != 2){
                throw new ArrayIndexOutOfBoundsException("参数个数不对");
            }

            //把接收到的参数转成整数
            int n1 = Integer.parseInt(args[0]);
            int n2 = Integer.parseInt(args[1]);

            int result = cal(n1, n2);
            System.out.println("计算结果是："+result);
        } catch (ArrayIndexOutOfBoundsException e) {
            e.printStackTrace();
        } catch (NumberFormatException e){
            System.out.println("参数格式不正确，需要输入整数");
        }catch (ArithmeticException e) {
            System.out.println("出现了除0的异常");
        }

    }
    public static int cal(int n1, int n2){
        return n1 / n2;
    }
}